import { Column, Entity, JoinTable, ManyToMany, OneToOne } from "typeorm";
import { BaseEntity } from "src/baseEntity";
import { Length } from "class-validator";
import { UserSys } from "./userSys.entity";

export enum UserEducation {
    小学 = "小学",
    初中 = "初中",
    高中 = "高中",
    中专 = "中专",
    大专 = "大专",
    本科 = "本科",
    研究生 = "研究生",
    博士 = "博士"
}

@Entity("user")
export class User extends BaseEntity {
    @OneToOne(() => UserSys, type => type.user)
    sys: UserSys

    @Column()
    @Length(1, 12)
    name: string

    @Column({ nullable: true, comment: "性别" })
    sex: boolean

    @Column({
        nullable: true,
        comment: "年龄"
    })
    age: number

    @Column({
        nullable: true,
        comment: "身份证号"
    })
    id_card: string

    @Column({
        nullable: true,
        comment: "学历",
        type: "enum",
        enum: UserEducation
    })
    education: UserEducation

    @Column({ nullable: true, comment: "毕业学校" })
    graduate: string

    @Column({ nullable: true, comment: "专业" })
    professional: string

    @Column({ type: "timestamp", nullable: true, comment: "毕业时间" })
    educationTime: Date

    @Column({ nullable: true, comment: "是否已毕业" })
    isGuaduation: boolean

    @Column({ nullable: true, comment: "籍贯" })
    nativePlace: string

    @Column({ nullable: true, comment: "家庭住址" })
    address: string

    @Column({ nullable: true, comment: "婚姻状况" })
    marriage: string

    @Column({ nullable: true, comment: "是否住宿" })
    isAccommodation: boolean

    @Column({ nullable: true, comment: "所在宿舍" })
    accommodation: string

    @Column({ comment: "紧急联系人", nullable: true })
    emergencyContact: string

    @Column({ comment: "紧急联系人关系", nullable: true })
    relative: string

    @Column({ comment: "紧急联系人电话", nullable: true })
    relativeMobile: string

    @Column({ comment: "工资卡账号", nullable: true })
    bank_card: string

    @Column({ comment: "开户银行", nullable: true })
    bank: string

    @Column({ comment: "开户行号", nullable: true })
    bank_number: string

    @Column({ comment: "是否签署合同", nullable: true })
    signContract: boolean

    @Column({ comment: "签署时间", type: "timestamp", nullable: true })
    signTime: Date

    @Column({ comment: "是否签署保密协议", nullable: true })
    confidentiality: boolean

    @Column({ comment: "签署时间", type: "timestamp", nullable: true })
    confidentialityTime: Date

    @Column({ comment: "是否签署宿舍", nullable: true })
    isSignAccommodation: boolean

    @Column({ comment: "签署时间", type: "timestamp", nullable: true })
    signAccommodationTime: Date

}